<?
$help['sandbox:make-config'] = 'creating configuration for branch';
$opt['sandbox:make-config'] = array('branch', 'dir', 'vars');

function cmd_sandbox_make_config($branch, $dir, $vars){
    echo "========================\nCreating configuration for sandbox...\n========\n";
    if(is_branch_dir()){
        if(!$dir) $dir = basename(getcwd());
        chdir('../');
    }
    echo "branch:$branch\ndir:$dir\n";
    read_props($vars, $dir, true);
    
    $vars['branch.name'] = $branch;
    $vars['branch.dir'] = $dir;
    $vars['branch.www'] = $dir;
    
    echo "\n";
    proc_prop_tpl(__DIR__ . '/../conf/tpl.properties', makePath($dir, '.props'), $vars, true);
    proc_prop_tpl(__DIR__ . '/../conf/apache.tpl.conf', __DIR__ . "/../conf/apache/$dir.conf", $vars, true);
}